<template>
	<view>
		<u-notice-bar v-show="TimeStatus" mode="horizontal" :list="barList"></u-notice-bar>
		<u-cell-group v-show="performanceStatus">
			<view v-for="(item,index) in list" :key="index">
				<u-cell-item :title="item.month"
							 :arrow="arrowSwitch"
							 :index="index"
							 >
							{{item.performance}}
				</u-cell-item>
			</view>
		</u-cell-group>
		<u-cell-group v-show="TimeStatus">
			<view v-for="(item,index) in list" :key="index">
				<u-cell-item :title="item.month"
							 :arrow="arrowSwitch"
							 :index="index"
							 >
							{{item.realityManTime}}/{{item.standardManTime}}
				</u-cell-item>
			</view>
		</u-cell-group>
	</view>
</template>

<script>
	import { getManTimeMoth, getUserPerformance } from '../utils/index.js'
	export default{
		data() {
			return {
				arrowSwitch: false,						//右侧箭头不需要
				jobNumber: '',							//被查询的员工的工号
				kind: '',								//绩效或工时查询判断
				list: [],								//存放后台获取的员工信息
				TimeStatus: '',							//展示工时开关
				performanceStatus: '',					//展示绩效开关
				barList: [
					"比值为：实际工时/标准工时"
				]
			}
		},
		methods: {
			async getInfoByKind() {
				let data = ''
				if(this.kind == '0') {					//展示绩效
					this.performanceStatus = true
					this.TimeStatus = false
					uni.setNavigationBarTitle({
						title: "员工绩效"
					})
					data = await getUserPerformance({jobNumber: this.jobNumber})
				} else {								//展示工时
					this.performanceStatus = false
					this.TimeStatus = true
					uni.setNavigationBarTitle({
						title: "员工工时"
					})
					data = await getManTimeMoth({jobNumber: this.jobNumber})
				}
				this.list = data.data.data
			}
		},
		onLoad(option) {
			this.jobNumber = option.jobNumber
			this.kind = option.kind
		},
		onShow() {
			this.getInfoByKind()
		}
	}
</script>

<style>
</style>
